Option Explicit On
Option Strict On

Imports System
Imports System.Collections.Generic


Imports KadGen.MetadataWrapper
Imports KadGen

Public Class All

#Region "GetWrapper Methods"

   Public Shared Function GetWrapper(ByVal xmlFileName As String) As MetadataWrapper.All
      Dim stream As IO.FileStream = Nothing
      Dim wrapper As MetadataWrapper.All = Nothing
      Try
         stream = New IO.FileStream(xmlFileName, IO.FileMode.Open)
         wrapper = GetWrapper(stream)
      Finally
         If stream IsNot Nothing Then
            stream.Close()
         End If
      End Try
      Return wrapper
   End Function

   Public Shared Function GetWrapper(ByVal xmlStream As IO.Stream) _
               As MetadataWrapper.All
      Dim doc As New Xml.XmlDocument
      doc.Load(xmlStream)

      'Dim mapping As MapMapping = MetadataAdapter.Map.GetWrapper(doc, Nothing)
      Dim build As BuildBuild = MetadataAdapter.Build.GetWrapper(doc, Nothing)
      Dim dataStructures As DbsDataStructureCollection = MetadataAdapter.Dbs.GetWrapper(doc, Nothing)
      Dim assembly As GenAssembly = MetadataAdapter.Gen.GetWrapper(doc, Nothing)

      Dim wrapper As New MetadataWrapper.All(assembly, dataStructures, Nothing, build)
      Return wrapper
   End Function
#End Region

End Class
